/**
 * 
 */
package exteditapp.action;

import exteditapp.state.StateEditing;

/**
 * @author arturas
 *
 */
public class ActionEditingManual extends IAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7818500889770100463L;

	/**
	 * This constructor is used from States - then we are describing state's action list
	 */
	public ActionEditingManual(){
		//set menu elements
		this.actionList = new IAction[] {
			new ActionUploading(true, "SAVE NOW"),
			this.setTextGetAction("Turn autosave on"),
			new ActionWaiting(true, "Open application (again)"),
			new ActionUnlocking(true, "End editing (without save)"),
		};
	}
	
	/**
	 * This constructor is used in menu construction - initializes action;
	 * @see exteditapp.action.IAction#init(boolean, String)
	 */
	public ActionEditingManual(boolean isEnabled, String newLabel){
		this.init(isEnabled, newLabel);
	}
	
	/**
	 * @see exteditapp.action.IAction#execute()
	 */
	public void execute() {
		this.main.getSettings().setRuntimeParameter("autosaveDisabled", "false");
		StateEditing newState = new StateEditing(this.main.getWorkingFile().getCurrentState().getIterator(), this.main.getWorkingFile());
		this.main.getWorkingFile().setCurrentState(newState);
	}

}
